#ifndef __SENSOR_ANGLE_H
#define __SENSOR_ANGLE_H



#include "stm32f1xx_hal.h"
#include "i2c.h"
#include "can.h"
#include "foc.h"


#define AS5600_RAW_ADDR    0x36
#define AS5600_ADDR        (AS5600_RAW_ADDR << 1)
#define AS5600_RAW_ANGLE_REGISTER  0x0C
#define AS5600_RESOLUTION 4096 

typedef enum
{
    CW      = 1, 
    CCW     = -1, 
    UNKNOWN = 0   
} Direction;




typedef struct AS5600{

	float* angle;
	float  m_speed;
	int sensor_dir;	
	
	void(*DeviceInit)(void);
	uint16_t(*GetRawAngle)(void);
	float(*GetRawAngleRad)(void);
	void (*GetAngle)(float*);
	float (*GetSpeed)(void);
	
}AS5600;

extern AS5600 as5600;


float speed_filter(float data);
#endif
